/**
 * Async Hooks module: https://nodejs.org/api/async_hooks.html
 */
声明 模块 "async_hooks" {
    /**
     * Returns the asyncId of the current execution context.
     */

    //@@{ 执行异步Id:executionAsyncId }
    函数 执行异步Id(): 数字;

    /**
     * Returns the ID of the resource responsible for calling the callback that is currently being executed.
     */

    //@@{ 触发异步Id:triggerAsyncId }
    函数 触发异步Id(): 数字;

    //@@{ 钩回调_:HookCallbacks }
    接口 钩回调_ {
        /**
         * Called when a class is constructed that has the possibility to emit an asynchronous event.
         * @param asyncId a unique ID for the async resource
         * @param type the type of the async resource
         * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
         * @param resource reference to the resource representing the async operation, needs to be released during destroy
         */

        //@@{ 初始化:init, 实例_:Object }
        初始化?(异步Id: 数字, 类型: 文字, 触发异步Id: 数字, 资源: 实例_): 无值;

        /**
         * When an asynchronous operation is initiated or completes a callback is called to notify the user.
         * The before callback is called just before said callback is executed.
         * @param asyncId the unique identifier assigned to the resource about to execute the callback.
         */

        //@@{ 之前:before }
        之前?(异步Id: 数字): 无值;

        /**
         * Called immediately after the callback specified in before is completed.
         * @param asyncId the unique identifier assigned to the resource which has executed the callback.
         */

        //@@{ 之后:after }
        之后?(异步Id: 数字): 无值;

        /**
         * Called when a promise has resolve() called. This may not be in the same execution id
         * as the promise itself.
         * @param asyncId the unique id for the promise that was resolve()d.
         */

        //@@{ 预设解决:promiseResolve }
        预设解决?(异步Id: 数字): 无值;

        /**
         * Called after the resource corresponding to asyncId is destroyed
         * @param asyncId a unique ID for the async resource
         */

        //@@{ 销毁:destroy }
        销毁?(异步Id: 数字): 无值;
    }

    //@@{ 异步钩_:AsyncHook }
    接口 异步钩_ {
        /**
         * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
         */

        //@@{ 启用:enable }
        启用(): 本体;

        /**
         * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
         */

        //@@{ 禁用:disable }
        禁用(): 本体;
    }

    /**
     * Registers functions to be called for different lifetime events of each async operation.
     * @param options the callbacks to register
     * @return an AsyncHooks instance used for disabling and enabling hooks
     */

    //@@{ 创建钩:createHook, 钩回调_:HookCallbacks, 异步钩_:AsyncHook }
    函数 创建钩(选项组: 钩回调_): 异步钩_;

    //@@{ 异步资源选项_:AsyncResourceOptions }
    接口 异步资源选项_ {
      /**
       * The ID of the execution context that created this async event.
       * Default: `executionAsyncId()`
       */

      //@@{ 触发异步Id:triggerAsyncId }
      触发异步Id?: 数字;

      /**
       * Disables automatic `emitDestroy` when the object is garbage collected.
       * This usually does not need to be set (even if `emitDestroy` is called
       * manually), unless the resource's `asyncId` is retrieved and the
       * sensitive API's `emitDestroy` is called with it.
       * Default: `false`
       */

      //@@{ 需要手动销毁:requireManualDestroy }
      需要手动销毁?: 真假;
    }

    /**
     * The class AsyncResource was designed to be extended by the embedder's async resources.
     * Using this users can easily trigger the lifetime events of their own resources.
     */

    //@@{ 异步资源_:AsyncResource }
    类别 异步资源_ {
        /**
         * AsyncResource() is meant to be extended. Instantiating a
         * new AsyncResource() also triggers init. If triggerAsyncId is omitted then
         * async_hook.executionAsyncId() is used.
         * @param type The type of async event.
         * @param triggerAsyncId The ID of the execution context that created
         *   this async event (default: `executionAsyncId()`), or an
         *   AsyncResourceOptions object (since 9.3)
         */

        //@@{ 异步资源选项_:AsyncResourceOptions }
        构造(类型: 文字, 触发异步Id?: 数字|异步资源选项_);

        /**
         * Call AsyncHooks before callbacks.
         * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
         */

        //@@{ 发射前:emitBefore }
        发射前(): 无值;

        /**
         * Call AsyncHooks after callbacks.
         * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
         */

        //@@{ 发射后:emitAfter }
        发射后(): 无值;

        /**
         * Call the provided function with the provided arguments in the
         * execution context of the async resource. This will establish the
         * context, trigger the AsyncHooks before callbacks, call the function,
         * trigger the AsyncHooks after callbacks, and then restore the original
         * execution context.
         * @param fn The function to call in the execution context of this
         *   async resource.
         * @param thisArg The receiver to be used for the function call.
         * @param args Optional arguments to pass to the function.
         */

        //@@{ 运行在异步范围:runInAsyncScope, 本体_:This, 结果_:Result }
        运行在异步范围<本体_, 结果_>(运行函数: (本体: 本体_, ...参数组: 任意[]) => 结果_, 本体参数?: 本体_, ...参数组: 任意[]): 结果_;

        /**
         * Call AsyncHooks destroy callbacks.
         */

        //@@{ 发射销毁:emitDestroy }
        发射销毁(): 无值;

        /**
         * @return the unique ID assigned to this AsyncResource instance.
         */

        //@@{ 异步Id:asyncId }
        异步Id(): 数字;

        /**
         * @return the trigger ID for this AsyncResource instance.
         */

        //@@{ 触发异步Id:triggerAsyncId }
        触发异步Id(): 数字;
    }
}
